# the minimum version of CMake.
cmake_minimum_required(VERSION 3.5.0)
project(mindspore_lite_video_enhance)

set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})

if(DEFINED PACKAGE_FIND_FILE)
    include(${PACKAGE_FIND_FILE})
endif()

include_directories(${NATIVERENDER_ROOT_PATH}
                    ${NATIVERENDER_ROOT_PATH}/include
                    ${NATIVERENDER_ROOT_PATH}/thirdparty/ffmpeg
                    ${NATIVERENDER_ROOT_PATH}/thirdparty/fftw3)

# 编译 mindspore_lite_video_enhance 库
file(GLOB_RECURSE SOURCES
    src/*.cpp)
add_library(mindspore_lite_video_enhance SHARED ${SOURCES})

# 设置输出库名称为 libmindspore_lite_video_enhance.so
set_target_properties(mindspore_lite_video_enhance PROPERTIES OUTPUT_NAME "mindspore_lite_video_enhance")

# 链接必要的库
file(GLOB FFMPEG_LIBS "${NATIVERENDER_ROOT_PATH}/../../../libs/${OHOS_ARCH}/ffmpeg/lib*")
target_link_libraries(mindspore_lite_video_enhance PUBLIC ${FFMPEG_LIBS})


target_link_libraries(mindspore_lite_video_enhance PUBLIC ${NATIVERENDER_ROOT_PATH}/../../../libs/${OHOS_ARCH}/fftw3/libfftw3f.so.3)
target_link_libraries(mindspore_lite_video_enhance PUBLIC ${NATIVERENDER_ROOT_PATH}/../../../libs/${OHOS_ARCH}/fftw3/libfftw3f_threads.so.3)
target_link_libraries(mindspore_lite_video_enhance PUBLIC hilog_ndk.z
                                   libace_napi.z.so
                                   mindspore_lite_ndk)

# 如果需要保留原来的entry库（包含napi_init.cpp）
file(GLOB_RECURSE ENTRY_SOURCES napi_init.cpp)
if(ENTRY_SOURCES)
    add_library(entry SHARED ${ENTRY_SOURCES})
    target_link_libraries(entry PUBLIC mindspore_lite_video_enhance)
    target_link_libraries(entry PUBLIC hilog_ndk.z libace_napi.z.so)
endif()

## the minimum version of CMake.
#cmake_minimum_required(VERSION 3.5.0)
#project(MSLiteModelRunTest)
#
#set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
#
#if(DEFINED PACKAGE_FIND_FILE)
#    include(${PACKAGE_FIND_FILE})
#endif()
#
#include_directories(${NATIVERENDER_ROOT_PATH}
#                    ${NATIVERENDER_ROOT_PATH}/include
#                    )
#
#add_library(entry SHARED napi_init.cpp MNNClass.cpp)
#target_link_libraries(entry PUBLIC libace_napi.z.so )
#target_link_libraries(entry PUBLIC mindspore_lite_ndk)
#target_link_libraries(entry PUBLIC hilog_ndk.z)
#
#file(GLOB FFMPEG_LIBS "${NATIVERENDER_ROOT_PATH}/../../../libs/${OHOS_ARCH}/ffmpeg/lib*")
#target_link_libraries(entry PUBLIC ${FFMPEG_LIBS})
#
#file(GLOB FFTW_LIBS "${NATIVERENDER_ROOT_PATH}/../../../libs/${OHOS_ARCH}/fftw3/lib*")
#target_link_libraries(entry PUBLIC ${FFTW_LIBS})